# import socket
#
# sk = socket.socket()
# sk.bind(('127.0.0.1', 8080))
# sk.listen()
# conn, addr = sk.accept()
# while 1:
#     ret = conn.recv(1024).decode('utf-8')
#     if ret == 'bye':
#         break
#     print(ret)
#     info = input('>>>')
#     conn.send(bytes(info, encoding='utf-8'))
# conn.close()
# sk.close()
from socket import *

username1 = 'aaa'
password1 = 123
sk = socket(AF_INET, SOCK_STREAM)
sk.bind(('127.0.0.1', 8080))
sk.listen()
conn, addr = sk.accept()
usr = 'aaa'
pwd = 123
username = conn.recv(512).decode('utf-8')
password = conn.recv(512).decode('utf-8')
if username == usr and int(password) == pwd:
    conn.send(bytes('登录成功', encoding='utf-8'))
else:
    conn.send(bytes('登录失败', encoding='utf-8'))
conn.close()
sk.close()